home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol F-12 / (Vol F-12) Jun 02 2012.iso / Screensaver / screensaver_installer.exe / ____swmx / scripts / frame_1 / DoAction_2.as < prev    next >
Text File  |  2004-10-21  |  3KB  |  140 lines

  1. _global.ScreenweaverDebug = function()
  2. {
  3.    this.init();
  4. };
  5. ScreenweaverDebug.prototype.init = function()
  6. {
  7.    this.sync = false;
  8. };
  9. ScreenweaverDebug.prototype.getSync = function()
  10. {
  11.    return this.sync;
  12. };
  13. ScreenweaverDebug.prototype.setSync = function(sync)
  14. {
  15.    this.sync = sync;
  16. };
  17. ScreenweaverDebug.prototype.syncTrace = function(section, arg, callback, scope)
  18. {
  19.    args = {section:section,message:arg};
  20.    swInterface.callMethod("syncTrace",args,callback,false,scope);
  21. };
  22. ScreenweaverDebug.prototype.trace = function(arg)
  23. {
  24.    if(!this.sync)
  25.    {
  26.       getURL("FSCommand:sw_utrace",arg);
  27.    }
  28.    else
  29.    {
  30.       this.syncTrace("user",arg);
  31.    }
  32. };
  33. ScreenweaverDebug.prototype.apiTrace = function(arg)
  34. {
  35.    if(!this.sync)
  36.    {
  37.       getURL("FSCommand:sw_atrace",arg);
  38.    }
  39.    else
  40.    {
  41.       this.syncTrace("api",arg);
  42.    }
  43. };
  44. ScreenweaverDebug.prototype.apiError = function(arg)
  45. {
  46.    if(!this.sync)
  47.    {
  48.       getURL("FSCommand:sw_etrace",arg);
  49.    }
  50.    else
  51.    {
  52.       this.syncTrace("error",arg);
  53.    }
  54. };
  55. ScreenweaverDebug.prototype.showWindow = function()
  56. {
  57.    fscommand("sw_showDebugWindow");
  58. };
  59. ScreenweaverDebug.prototype.hideWindow = function()
  60. {
  61.    fscommand("sw_hideDebugWindow");
  62. };
  63. ScreenweaverDebug.prototype.toggleVisibility = function()
  64. {
  65.    fscommand("sw_toggleVisibilityDebugWindow");
  66. };
  67. ScreenweaverDebug.prototype.traceObject = function(obj)
  68. {
  69.    var swTraceObject = new ScreenweaverTraceObject(obj);
  70.    delete swTraceObject;
  71. };
  72. _global.ScreenweaverTraceObject = function()
  73. {
  74.    this.init.apply(this,arguments);
  75. };
  76. ScreenweaverTraceObject.prototype.init = function(obj)
  77. {
  78.    this.parse.us = this;
  79.    var output = this.parse(obj);
  80.    swDebug.trace(output);
  81. };
  82. ScreenweaverTraceObject.prototype.indent = function(i)
  83. {
  84.    var output = "";
  85.    var j = 0;
  86.    while(j < i)
  87.    {
  88.       output += "\t";
  89.       j++;
  90.    }
  91.    return output;
  92. };
  93. ScreenweaverTraceObject.prototype.parse = function(obj, i, name)
  94. {
  95.    var output = "";
  96.    var us = arguments.callee.us;
  97.    if(i == undefined)
  98.    {
  99.       i == 0;
  100.    }
  101.    output += us.indent(i);
  102.    if(obj instanceof Array)
  103.    {
  104.       output += "[\n";
  105.       var j = 0;
  106.       while(j < obj.length)
  107.       {
  108.          output += arguments.callee(obj[j],i + 1,j);
  109.          j++;
  110.       }
  111.       output += us.indent(i);
  112.       output += "]\n";
  113.    }
  114.    else if(obj instanceof Object)
  115.    {
  116.       output += "{\n";
  117.       for(member in obj)
  118.       {
  119.          output += arguments.callee(obj[member],i + 1,member);
  120.       }
  121.       output += us.indent(i);
  122.       output += "}\n";
  123.    }
  124.    else
  125.    {
  126.       output += name + ": ";
  127.       if(type eq "string")
  128.       {
  129.          output += "\"";
  130.       }
  131.       output += obj;
  132.       if(type eq "string")
  133.       {
  134.          output += "\"";
  135.       }
  136.       output += "\n";
  137.    }
  138.    return output;
  139. };
  140.